package com.topone.Utils;

import com.topone.Enum.CodeEnum;

/**
 * Created by Administrator on 2017/12/15,0015.
 */
public class EnumUnitl {
    public static <T extends CodeEnum> T getByCode(Integer code, Class<T> enumClass){
        for(T each:enumClass.getEnumConstants()){
            if(code.equals(each.getCode())){
                return each;
            }
        }
        return null;
    }
}
